package tpo.wmb.provider.dao;


import com.github.pagehelper.PageInfo;
import dto.Dto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import pojo.BuyOrder;

import java.util.List;
import java.util.Map;

@Repository
public interface OrderMapper {
    /**
     *订单分页条件查询
     */
    List<BuyOrder> selectOrderList(Map<String,Object> map);

    /**
     * 查看订单详情
     */
    BuyOrder selectOrder(Integer id);

    /**
     * 修改订单
     */
    Integer updateOrder( BuyOrder buyOrder);

    /**
     * 新增订单
     */
    Integer insertOrder( BuyOrder buyOrder);

    /**
     * (逻辑)删除订单
     */
    @Update(" update buy_order set isDelete=0 where id = #{id}")//简单语句使用注解
    Integer deleteOrder( Integer id);

    /**
     * 修改订单状态
     * @param
     * @return
     */
    Integer updateOrderState(Integer orderStaId,Integer recStaId,Integer id);


    /**
     * (真)删除订单
     * @param code
     * @return
     */
    @Delete("delete from buy_order where code = #{code}")
    Integer deleteOrder2(String code);

    /**
     * 查询用户所有订单
     * @param userId
     * @return
     */
    @Select("select * from buy_order where userId = #{userId} and isdelete = 1 and orderStaId = 15")
    List<BuyOrder> selectOrderList2( Integer userId);


    /**
     * code查看订单详情
     * @param code
     * @return
     */
    @Select("select * from buy_order where code = #{code}")
    BuyOrder selectOrdeCoder(String code);

}
